/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package us.icitap.cm.business.entities.regmin;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import us.icitap.cm.business.entities.BaseEntity;


/**
 *
 * @author klau
 */
@Entity
@Table(name = "CITIES", schema="REGMIN")
public class Cities  implements Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 935719823886597590L;
	
	
	@EmbeddedId
    protected CitiesPK citiesPK;
	 @Column(name = "TAG")
	 private String tag;
	 
    @Column(name = "VILLAGE")
    private Character village;
  

    @JoinColumn(name = "CODE_DISTRICT", referencedColumnName = "CODE_DISTRICT")
    @ManyToOne
    private District district;
    
    
    @JoinColumn(name = "CODE_STATE", referencedColumnName = "CODE_STATE", insertable = false, updatable = false)
    @ManyToOne
    private States states;


    public Cities() {
    }

    public Cities(CitiesPK citiesPK) {
        this.citiesPK = citiesPK;
    }

    public Cities(String codeState, String codeCity) {
        this.citiesPK = new CitiesPK(codeState, codeCity);
    }

    public CitiesPK getCitiesPK() {
        return citiesPK;
    }

    public void setCitiesPK(CitiesPK citiesPK) {
        this.citiesPK = citiesPK;
    }



    public Character getVillage() {
        return village;
    }

    public void setVillage(Character village) {
        this.village = village;
    }

  

    public States getStates() {
        return states;
    }

    public void setStates(States states) {
        this.states = states;
    }

    public District getDistrict() {
        return district;
    }

    public void setDistrict(District district) {
        this.district = district;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (citiesPK != null ? citiesPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cities)) {
            return false;
        }
        Cities other = (Cities) object;
        if ((this.citiesPK == null && other.citiesPK != null) || (this.citiesPK != null && !this.citiesPK.equals(other.citiesPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return  this.getTag();
    }

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

}
